package net.modul.district.action;

import java.util.ArrayList;
import java.util.List;

import net.common.action.GeneralAction;
import net.modul.district.service.DistrictDeleteService;
import net.modul.district.service.DistrictEditorService;
import net.modul.district.service.DistrictFindService;
import net.modul.district.service.DistrictSearchService;
import net.modul.district.vo.DistrictVo;

public class DistrictAction extends GeneralAction {

	private static final long serialVersionUID = 7127573666355745443L;

	private DistrictVo bean = new DistrictVo();
	private List<DistrictVo> list = new ArrayList<DistrictVo>();
	
	public String search() throws Exception {
		DistrictSearchService service = new DistrictSearchService();
		service.invoke();
		list = service.getList();
		return SUCCESS;
	}
	
	public String editor() throws Exception {
		DistrictEditorService service = new DistrictEditorService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}
	
	public String find() throws Exception {
		if(bean.getDistrict_id() != null) {			
			DistrictFindService service = new DistrictFindService();
			service.setId(bean.getDistrict_id());
			service.invoke();
		}
		return SUCCESS;
	}
	
	public String delete() throws Exception {
		DistrictDeleteService service = new DistrictDeleteService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}
	
	public DistrictVo getBean() {
		return bean;
	}
	public void setBean(DistrictVo bean) {
		this.bean = bean;
	}
	public List<DistrictVo> getList() {
		return list;
	}
	public void setList(List<DistrictVo> list) {
		this.list = list;
	}
}
